﻿//////////////////////////////////////////////////////////////////////////////
//
// Copyright © 1998-2024 Glodon Company Limited.
//
// Licensed under the MIT License
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the “Software”),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//////////////////////////////////////////////////////////////////////////////
#pragma once

#include <qdialog.h>
#include <QCheckBox>
#include "ElementId.h"
#include "Color.h"

namespace gcmp
{
    class IDocument;
    class UniIdentity;
}

QT_BEGIN_NAMESPACE
class QComboBox;
class QLineEdit;
QT_END_NAMESPACE

class FaceStyleSettingDialog : public QDialog
{
    Q_OBJECT

public:
    FaceStyleSettingDialog(gcmp::IDocument * doc, const gcmp::UniIdentity& categoryUid, const gcmp::Color& faceColor, const gcmp::Color& sectionFaceColor,
        const gcmp::Color& projectionFaceHatchColor, const std::wstring& projectionFaceHatchPattern, const double projectionFaceHatchAngle, const double projectionFaceHatchScale, const gcmp::Color& sectionFaceHatchColor,
        const std::wstring& sectionFaceHatchPattern, const double sectionHatchAngle, const double sectionHatchScale);

    const gcmp::Color& GetFaceColor() const { return m_faceColor; }
    const gcmp::Color& GetSectionFaceColor() const;
    const gcmp::Color& GetProjectionFaceHatchColor() const { return m_projectionFaceHatchColor; }
    const std::wstring& GetProjectionFaceHatchPattern() const { return m_projectionFaceHatchPattern; }
    const gcmp::Color& GetSectionFaceHatchColor() const { return m_sectionFaceHatchColor; }
    const std::wstring& GetSectionFaceHatchPattern() const { return m_sectionFaceHatchPattern; }
    const double GetProjectionFaceHatchAngle() const { return m_projectionFaceHatchAngle; }
    const double GetProjectionFaceHatchScale() const { return m_projectionFaceHatchScale; }
    const double GetSectionFaceHatchAngle() const { return m_sectionHatchAngle; }
    const double GetSectionFaceHatchScale() const { return m_sectionHatchScale; }
    
private slots:
    void OkButtonClicked();
    void CancelButtonClicked();
    void FaceColorButtonClicked();
    void SectionFaceColorButtonClicked();
    void ProjectionFaceHatchColorButtonClicked();
    void SectionFaceHatchColorButtonClicked();
    
private:
    gcmp::ElementId m_materialId;
    gcmp::Color     m_faceColor;
    gcmp::Color     m_sectionFaceColor;
    gcmp::Color     m_projectionFaceHatchColor;
    std::wstring    m_projectionFaceHatchPattern;
    double          m_projectionFaceHatchAngle;
    double          m_projectionFaceHatchScale;
    gcmp::Color     m_sectionFaceHatchColor;
    std::wstring    m_sectionFaceHatchPattern;
    double          m_sectionHatchAngle;
    double          m_sectionHatchScale;

private:
    gcmp::IDocument * m_doc;
    const gcmp::UniIdentity&    m_categoryUid;
    QPushButton*                m_pPushButtonFaceColor;
    QPushButton*                m_pPushButtonSectionFaceColor;
    QPushButton*                m_pPushButtonProjectionFaceFillingColor;
    QComboBox*                  m_pComboBoxProjectionFaceHatchPattern;
    QLineEdit*                  m_pLineEditProjectionFaceHatchAngle;
    QLineEdit*                  m_pLineEditProjectionFaceHatchScale;
    QPushButton*                m_pPushButtonSectionFillingColor;
    QComboBox*                  m_pComboBoxSectionFillingHatchPattern;
    QLineEdit*                  m_pLineEditSectionHatchAngle;
    QLineEdit*                  m_pLineEditSectionHatchScale;
};
